import ajax from './index'

export function product_list(condition) {
    if(!condition) {
        condition = {
            pageNum: 1,
            pageSize: 100
        }
    }
    return ajax({
        url: "/backend/product/list",
        method: "get",
        params: condition
    });
}

export function product_save(param) {
    return ajax({
        url: "/backend/product/save",
        method: "post",
        data: param
    });
}

export function product_check(param) {
    return ajax({
        url: "/backend/product/check",
        method: "post",
        data: param
    });
}

export function product_wholesale(param) {
    return ajax({
        url: "/backend/product/wholesale",
        method: "post",
        data: param
    });
}
export function product_detail(id) {
    return ajax({
        url: "/backend/product/detail" + "/" + id,
        method: "get"
    });
}

export function product_alibaba_detail(id) {
    return ajax({
        url: "/backend/product/alibaba_detail" + "/" + id,
        method: "get"
    });
}
export function product_delete(id) {
    return ajax({
        url: "/backend/product/delete",
        method: "post",
        data: {
            id: id
        }
    });
}

export function product_update_order(param) {
    return ajax({
        url: "/backend/product/update_order",
        method: "post",
        data: param
    });
}

export function product_update_stock(param) {
    return ajax({
        url: "/backend/product/update_stock",
        method: "post",
        data: param
    });
}

export function product_up(param) {
    return ajax({
        url: "/backend/product/up",
        method: "post",
        data: param
    });
}

export function product_remove(param) {
    return ajax({
        url: "/backend/product/remove",
        method: "post",
        data: param
    });
}

export function product_down(param) {
    return ajax({
        url: "/backend/product/down",
        method: "post",
        data: param
    });
}
export function product_sale_count() {
    return ajax({
        url: "/backend/product/sale_count",
        method: "get"
    });
}

export function product_category_history() {
    return ajax({
        url: "/backend/product/categoryHistory",
        method: "get"
    });
}
export function productExport(query) {
    return ajax({
        url: '/backend/product/export',
        method: 'get',
        params: query
    });
}
export function product_category_list() {
    return ajax({
        url: "/backend/product_industry/listAll",
        method: "get",
    });
}

export function productImport(data) {
    return ajax({
        url: '/backend/product/import',
        method: 'post',
        data: data
    })
}